<template>
  <div>
    <div class="flex-start m-b-30">
      <el-button icon="el-icon-back" plain round size="small" type="primary" @click="back">返回</el-button>
      <div class="title">质检入库</div>
    </div>
    <div class="steps">
        <div class="line">1、请先确认设备联网是否正常</div>
        <div class="content">
          <div style="color: red">4G类型，请安装流量卡</div>
          <div style="color: red">wifi类型，请配网</div>
        </div>
      <div class="line">2、请设置自动调和功能</div>
      {{theRow}}
      <div class="content">
        <div class="flex-start">
          <div>自动调和功能：</div>
          <el-radio v-model="isMix" :label="0">无</el-radio>
          <el-radio v-model="isMix" :label="1">有</el-radio>
          <el-button type="primary" size="small" @click="set">设置</el-button>
        </div>
      </div>
      <div class="line">3、确认以下质检项</div>
      <div class="content">
        <div class="flex-start m-b-10">
          <i  class="el-icon-success"></i>
          <div>联网方式：4G</div>
        </div>
        <div class="flex-start m-b-10">
          <i class="el-icon-success"></i>
          <div>泵液功能：有</div>
        </div>
        <div class="flex-start m-b-10">
          <i class="el-icon-success"></i>
          <div>自动调配功能：有</div>
        </div>
        <div class="flex-start m-b-10">
          <i class="el-icon-success"></i>
          <div>传感器：有正常显示</div>
        </div>
        <div class="flex-start m-b-10">
          <i class="el-icon-success"></i>
          <div>泵液：正常操作</div>
        </div>
      </div>
      <el-button class="btn" type="primary" size="small">质检入库</el-button>
    </div>
  </div>
</template>

<script>
import {facmachineCheck} from "@/api/product/mac";

export default {
  name: "DeviceQA",
  props: {
    theRow: {
      type: Object
    }
  },
  data() {
    return {
      isMix: ''
    }
  },
  watch: {
    theRow: {
      immediate: true,
      handler: function () {
        if(this.theRow.isPump===0) {
          this.isMix = this.theRow.isPump
        }
      }
    }
  },
  methods: {
    back() {
      this.$emit('back')
    },
    submit() {
      if(this.isMix==='') {
        return this.$message.warning('请先设置自动调和功能！')
      }
      this.set()
    },
    set() {
      if( this.isMix==='' ) return ;
      facmachineCheck({id: this.theRow.id, isMix: this.isMix}).then(res => {
        this.theRow.isMix = this.isMix
        this.$message.warning('设置成功！')
      })
    }
  }
}
</script>

<style scoped lang="scss">
.title {
  font-weight: bold;
  margin-left: 20px;
  color: #333;
}
.line {
  margin-top: 20px;
  margin-bottom: 10px;
}
.content {
  margin-left: 20px;
}
.el-icon-success {
  color: #1e9fff;
  margin-right: 10px;
}
.btn {
  margin-top: 60px;
  margin-left: 20px;
}
</style>
